package testcases;

import static org.junit.Assert.*;

import org.junit.Test;

import code.CheckingAccount;
import code.DebitCard;

public class DebitCardTest {
	
	DebitCard no_limit_dc;
	DebitCard limit_dc;
	CheckingAccount account_debt;

	public void runTest() {
		account_debt =  new CheckingAccount("Joe", "3rd C st.", "67890", "Tacoma", "USA", -3.6f);
		
		no_limit_dc = new DebitCard("Billy", "1 main st.", "Seattle", "12345", "USA");
		limit_dc = new DebitCard("Joe", "3rd C st.", "Tacoma", "67890", "USA", 100.00, account_debt);
		
		testFields();
		testPay();
	}
	
	public void testFields(){
		assertEquals("Billy", no_limit_dc.fName);
		assertEquals("1 main st.", no_limit_dc.fStreet);
		assertEquals("Seattle", no_limit_dc.fTown);
		assertEquals("12345", no_limit_dc.fZipCode);
		assertEquals("USA", no_limit_dc.fCountry);
		assertEquals(1, no_limit_dc.fDebitCardNumber);
		
		assertEquals("Joe", limit_dc.fName);
		assertEquals("3rd C st.", limit_dc.fStreet);
		assertEquals("Tacoma", limit_dc.fTown);
		assertEquals("67890", limit_dc.fZipCode);
		assertEquals("USA", limit_dc.fCountry);
		assertEquals(account_debt, limit_dc.fAccountConnectedTo);
		
	}
	
	public void testPay(){
		assertTrue(limit_dc.pay(100));
		assertFalse(limit_dc.pay(-105.00));
	}

}
